package com.bush.mall.order.controller;

import org.springframework.web.bind.annotation.*;
import com.bush.mall.common.entity.Result;;
import com.bush.mall.order.entity.OrderSettingEntity;
import com.bush.mall.order.service.OrderSettingService;
import javax.annotation.Resource;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 订单配置信息
 * @author RUN
 * @date 2022-11-29
 */
@RestController
@RequestMapping("ordersetting")
@Api(tags = "订单配置信息管理" )
public class OrderSettingController {

    @Resource(name= OrderSettingService.BEAN_ID)
    private OrderSettingService orderSettingService;

    /**
     * 分页查询订单配置信息列表
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "分页查询订单配置信息列表")
    @GetMapping("queryForPage")
    public Result queryForPage(Integer current,Integer size){
        return orderSettingService.queryForPage(current,size);
    }

    /**
     * 保存订单配置信息表单
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "保存订单配置信息表单")
    @PostMapping
    public Result saveOrderSetting(@RequestBody OrderSettingEntity orderSetting){
        return orderSettingService.saveOrderSetting(orderSetting);
    }

    /**
     * 修改订单配置信息表单
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "修改订单配置信息表单")
    @PutMapping
    public Result updateOrderSetting(@RequestBody OrderSettingEntity orderSetting){
        return orderSettingService.updateOrderSetting(orderSetting);
    }

    /**
     * 通过指定id删除订单配置信息
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "通过指定id删除订单配置信息")
    @DeleteMapping
    public Result deleteOrderSetting(Long id){
        return orderSettingService.deleteOrderSetting(id);
    }

}
